其他
有了这条Linux命令,终于可以肆无忌惮的在Linux上写Python了
你好,我是李逸皓,我的梦想是:运维,永不背锅!
放个链接,万一有人关注呢
优质文章推荐
↓ ↓ ↓ ↓ ↓
pip install yapf
yapf [-h] [-v] [-d | -i | -q] [-r | -l START-END] [-e PATTERN] [--style STYLE] [--style-help] [--no-local-style] [-p] [-vv] [files ...]
x = { 'a':37,'b':42, 'c':927}
y = 'hello ''world'
z = 'hello '+'world'
a = 'hello {}'.format('world')
class foo ( object ):
def f (self ):
return 37*-+2
def g(self, x,y=42):
return y
def f ( a ) :
return 37+-+a[42-x : y**3]
yapf -i 1.py
from yapf.yapflib.yapf_api import FormatCode
formatted_code, changed = FormatCode("f ( a = 1, b = 2 )")
print(formatted_code) # 'f(a=1, b=2)\n'
print(changed) # True
from yapf.yapflib.yapf_api import FormatCode
print(FormatCode("def g():\n return True", style_config='pep8')[0]) # 'def g():\n return True\n'
粉丝进群方式如下图:
↓↓↓ 点个在看,无需赞赏!